package org.dtrd.modules.shop.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.shop.entity.bean.PatientAddressDetail;


/**
 * <p>
 * 收货地址表
 * </p>
 *
 * @author sun
 * @since 2022-07-23
 */
@Getter
@Setter
@TableName("dtrd_ent_shc_rd_patient_address")
public class DtrdEntShcRdPatientAddress {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    /**
     * 患者id
     */
    @TableField("patient_id")
    private Integer patientId;

    /**
     * 收货人
     */
    @TableField("contact_person")
    private String contactPerson;

    /**
     * 联系电话
     */
    @TableField("contact_phone")
    private String contactPhone;

    /**
     * 省id
     */
    @TableField("contact_province_id")
    private String contactProvinceId;

    /**
     * 省
     */
    @TableField("contact_province_name")
    private String contactProvinceName;

    /**
     * 市id
     */
    @TableField("contact_city_id")
    private String contactCityId;

    /**
     * 市
     */
    @TableField("contact_city_name")
    private String contactCityName;

    /**
     * 区id
     */
    @TableField("contact_district_id")
    private String contactDistrictId;

    /**
     * 区
     */
    @TableField("contact_district_name")
    private String contactDistrictName;

    /**
     * 详细地址
     */
    @TableField("contact_address")
    private String contactAddress;

    /**
     * 默认地址：0-否，1-是
     */
    @TableField("is_default")
    private Integer isDefault;

    @TableField("create_time")
    private Date createTime;

    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    public DtrdEntShcRdPatientAddress init() {
        createTime = new Date();
        isDel = 0;
        return this;
    }

    public DtrdEntShcRdPatientAddress parseFromDto(PatientAddressDetail dto) {
        dataId = dto.getDataId();
        patientId = dto.getPatientId();
        contactPerson = dto.getContactPerson();
        contactPhone = dto.getContactPhone();
        contactProvinceId = dto.getContactProvinceId();
        contactProvinceName = dto.getContactProvinceName();
        contactCityId = dto.getContactCityId();
        contactCityName = dto.getContactCityName();
        contactDistrictId = dto.getContactDistrictId();
        contactDistrictName = dto.getContactDistrictName();
        contactAddress = dto.getContactAddress();
        isDefault = dto.getIsDefault();
        return this;
    }


}
